home *** CD-ROM | disk | FTP | other *** search
/ Palm Pilot Collection / Palm Pilot Collection (Explore the World of Software) (1998).iso / apps / weather2.exe / grabwthr.bat < prev    next >
DOS Batch File  |  1997-12-24  |  9KB  |  201 lines

  1.  
  2. REM -- This is GRABWTHR.BAT
  3.  
  4.  
  5. rem -- POINTCAST VERSION 1 USERS:
  6. rem -- ==========================
  7. rem -- PointCast version 1. keeps its weather files in a subfolder called
  8. rem -- "weather" in a file called "wcity2.lst". So to use that version
  9. rem -- of PointCast, you would: 
  10.  
  11. rem -- First, edit the following line so that it specifies whatever
  12. rem -- folder PointCast is set up in on your system,
  13. rem -- then second, strip off the "REM --" in front of the line.
  14. rem -- That should do it. 
  15.  
  16. rem ---------------------USER MODIFIABLE---------------------
  17. rem -- copy "C:\Program Files\PointCast\weather\wcity2.lst" wthrcopy.tmp
  18. rem ---------------------USER MODIFIABLE---------------------
  19.  
  20.  
  21.  
  22. rem -- POINTCAST VERSION 2 USERS:
  23. rem -- ==========================
  24. rem -- PoinCast version 2 changes the file name each time it gets
  25. rem -- the weather, but the folder seems constant, and the file
  26. rem -- name appears always to start with "4" and contain five digits.
  27. rem -- So the line below has worked for me through several weeks
  28. rem -- of testing, though I can't guarantee that it will always work.
  29. rem -- In any event, if you are using PointCast version 2., do this: 
  30.  
  31. rem -- First, edit the following line so that it specifies whatever
  32. rem -- folder PointCast is set up in on your system,
  33. rem -- then second, strip off the "REM --" in front of the line.
  34. rem -- That should do it until PointCast fools us all with another change. 
  35.  
  36. rem ---------------------USER MODIFIABLE---------------------
  37. copy "C:\Program Files\PointCast 2.0\lcm\0\4????.dat" wthrcopy.tmp
  38. rem ---------------------USER MODIFIABLE---------------------
  39.  
  40.  
  41.  
  42. rem -- Extract current date from PREAMBLE line and create wther.tmp
  43. mt /xqon+  wthrcopy.tmp  /  "^(PREAMBLE,.*\d{9},\".*\")"  = "\5\r\n\t\tHi\tLo\tConditions\r\n\t\t--\t--\t----------\r\n"  >wthr.tmp
  44.  
  45. rem -- Change case of AM and PM just because I like it better
  46. rem -- and delete the "Eastern" time label
  47. mt /xqn+  wthr.tmp  /  "AM" = " am"  "PM" = " pm"  "\sEastern" = \z
  48.  
  49.  
  50. rem -- HERE IS WHERE YOU CAN SPECIFY A FULL NAME+STATE IF YOU
  51. rem -- WANT TO. THIS IS ALSO USEFUL FOR CITIES (LIKE WHERE
  52. rem -- LIVE) THAT YOU MIGHT ALWAYS WANT INCLUDED IN THE OUTPUT DOC FILE.
  53.  
  54. rem -- Note that the city name must begin with one leading 
  55. rem -- quote, and the two letter state abbreviation must
  56. rem -- be followed by period-asterisk-dollarsign-quote. 
  57. rem -- Cities outside the U.S. do not have a "state" or even 
  58. rem -- a "country" specification--you just use the city name. 
  59.  
  60. rem -- Here some sample cities: if you want the weather for any
  61. rem -- of them, just strip off the "REM -- " at the beginning of
  62. rem -- the line. Or edit any of the lines to put in another
  63. rem -- city of your choice. 
  64.  
  65. mt /xoqn+  wthrcopy.tmp  /  "^(L,\"Williamsburg, VA.*$" = "\i" >>wthr.tmp
  66.  
  67. rem ---------------------USER MODIFIABLE---------------------
  68. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"Baton Rouge, LA.*$" = "\i" >>wthr.tmp
  69. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"Honolulu, HI.*$" = "\i" >>wthr.tmp
  70. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"Las Cruces, NM.*$" = "\i" >>wthr.tm
  71. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"Las Vegas, NV.*$" = "\i" >>wthr.tmp
  72. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"Los Angeles, CA.*$" = "\i" >>wthr.tmp
  73. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"New York (JFK), NY.*$" = "\i" >>wthr.tmp
  74. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"New York (LGA), NY.*$" = "\i" >>wthr.tmp
  75. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"New Orleans, LA.*$" = "\i" >>wthr.tmp
  76. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"Richmond, VA.*$" = "\i" >>wthr.tmp
  77. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"Saginaw, MI.*$" = "\i" >>wthr.tmp
  78. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"San Angelo, TX.*$" = "\i" >>wthr.tmp
  79. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"San Antonio, TX.*$" = "\i" >>wthr.tmp
  80. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"San Diego, CA.*$" = "\i" >>wthr.tmp
  81. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"San Francisco, CA.*$" = "\i" >>wthr.tmp
  82. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"San Jose, CA.*$" = "\i" >>wthr.tmp
  83. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"San Juan, PR.*$" = "\i" >>wthr.tmp
  84. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"San Luis Obispo, CA.*$" = "\i" >>wthr.tmp
  85. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"Santa Barbara, CA.*$" = "\i" >>wthr.tmp
  86. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"Santa Fe, NM.*$" = "\i" >>wthr.tmp
  87. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"Santa Maria, CA.*$" = "\i" >>wthr.tmp
  88. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"Texarkana, AR.*$" = "\i" >>wthr.tmp
  89. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"Montreal.*$" = "\i" >>wthr.tmp
  90. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"Ottawa.*$" = "\i" >>wthr.tmp
  91. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"Quebec.*$" = "\i" >>wthr.tmp
  92. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"Vancouver.*$" = "\i" >>wthr.tmp
  93. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"Casablanca.*$" = "\i" >>wthr.tmp
  94. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"Nairobi.*$" = "\i" >>wthr.tmp
  95. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"Ho Chi Minh City.*$" = "\i" >>wthr.tmp
  96. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"Hong Kong.*$" = "\i" >>wthr.tmp
  97. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"Nanjing.*$" = "\i" >>wthr.tmp
  98. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"Tokyo.*$" = "\i" >>wthr.tmp
  99. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"Seoul.*$" = "\i" >>wthr.tmp
  100. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"Adelaide.*$" = "\i" >>wthr.tmp
  101. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"Melbourne.*$" = "\i" >>wthr.tmp
  102. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"Havana.*$" = "\i" >>wthr.tmp
  103. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"Athens.*$" = "\i" >>wthr.tmp
  104. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"Mexico City.*$" = "\i" >>wthr.tmp
  105. rem -- mt /xoqn+  wthrcopy.tmp  /  "^(L,\"Rio de Janeiro.*$" = "\i" >>wthr.tmp
  106. rem ---------------------USER MODIFIABLE---------------------
  107.  
  108.  
  109.  
  110. rem -- Here is where this batch file picks up the city names 
  111. rem -- that have been passed as parameters from the CITYLIST.BAT file. 
  112.  
  113. if (%1) == () goto NEXT
  114. mt /xoqn+  wthrcopy.tmp  /  "^(L,\"%1.*$" = "\i" >>wthr.tmp
  115. if (%2) == () goto NEXT
  116. mt /xoqn+  wthrcopy.tmp  /  "^(L,\"%2.*$" = "\i" >>wthr.tmp
  117. if (%3) == () goto NEXT
  118. mt /xoqn+  wthrcopy.tmp  /  "^(L,\"%3.*$" = "\i" >>wthr.tmp
  119. if (%4) == () goto NEXT
  120. mt /xoqn+  wthrcopy.tmp  /  "^(L,\"%4.*$" = "\i" >>wthr.tmp
  121. if (%5) == () goto NEXT
  122. mt /xoqn+  wthrcopy.tmp  /  "^(L,\"%5.*$" = "\i" >>wthr.tmp
  123. if (%6) == () goto NEXT
  124. mt /xoqn+  wthrcopy.tmp  /  "^(L,\"%6.*$" = "\i" >>wthr.tmp
  125. if (%7) == () goto NEXT
  126. mt /xoqn+  wthrcopy.tmp  /  "^(L,\"%7.*$" = "\i" >>wthr.tmp
  127. if (%8) == () goto NEXT
  128. mt /xoqn+  wthrcopy.tmp  /  "^(L,\"%8.*$" = "\i" >>wthr.tmp
  129. if (%9) == () goto NEXT
  130. mt /xoqn+  wthrcopy.tmp  /  "^(L,\"%9.*$" = "\i" >>wthr.tmp
  131.  
  132. :NEXT
  133.  
  134.  
  135. rem -- For some reason some of the line breaks 
  136. rem -- at this point have two CRs and one LF, so fix it:
  137. mt /xqn+  wthr.tmp  /  "\r\r\n" =  "\r\n"
  138.  
  139.  
  140. rem -- Now decode the weather forecast codes
  141.  
  142. mt /xqn+  wthr.tmp  /  ",0,)" = "\tSunny\r\n" 
  143. mt /xqn+  wthr.tmp  /  ",1,)" = "\tFair\r\n" 
  144. mt /xqn+  wthr.tmp  /  ",2,)" = "\tPartly Cloudy\r\n" 
  145. mt /xqn+  wthr.tmp  /  ",3,)" = "\tMostly Cloudy\r\n"
  146. mt /xqn+  wthr.tmp  /  ",4,)" = "\tCloudy\r\n" 
  147. mt /xqn+  wthr.tmp  /  ",5,)" = "\tT-Storms\r\n"
  148. mt /xqn+  wthr.tmp  /  ",6,)" = "\tWindy\r\n" 
  149. mt /xqn+  wthr.tmp  /  ",7.)" = "\tRain\r\n"
  150. mt /xqn+  wthr.tmp  /  ",8,)" = "\tShowers\r\n" 
  151. mt /xqn+  wthr.tmp  /  ",9,)" = "\tSnow\r\n"
  152. mt /xqn+  wthr.tmp  /  ",10,)" = "\tFlurries\r\n"
  153. mt /xqn+  wthr.tmp  /  ",18,)" = "\tFreezing Rain\r\n"
  154.  
  155. mt /xqn+  wthr.tmp /  "'(-1,,,'-?\d{1,3},-?\d{1,3}" = "...yda\t\2\3\t\5\6" 
  156. mt /xqn+  wthr.tmp  /  "'(0,,,'-?\d{1,3},-?\d{1,3}" = "TODAY\t\2\3\t\5\6"
  157. mt /xqn+  wthr.tmp  /  "'(1,,,'-?\d{1,3},-?\d{1,3}" = "Tmro\t\2\3\t\5\6" 
  158. mt /xqn+  wthr.tmp  /  "'(2,,,'-?\d{1,3},-?\d{1,3}" = "Next\t\2\3\t\5\6" 
  159. mt /xqn+  wthr.tmp  /  "'(3,,,'-?\d{1,3},-?\d{1,3}" = "After\t\2\3\t\5\6"
  160.  
  161.  
  162.  
  163.  
  164.  
  165. rem -- Delete the stuff surrounding city names and insert
  166. rem -- special characters for a DOC bookmark.
  167. rem -- I use three spaces as the bookmark because it
  168. rem -- looks better on screen than two. But YMMV.
  169. rem -- They don't even have to be spaces, for that matter.
  170. mt /xqn+  wthr.tmp  /  "^(L,\".*\")" = "   \2\r\n"   
  171.  
  172.  
  173. rem -- Add the DOC "autobookmark" indicator: whatever appears
  174. rem -- at the end of the file between angle brackets is treated
  175. rem -- by DOC as an autobookmark indicator. I put the actual
  176. rem -- text in a separate file so I can include the spaces. 
  177. type autobook.txt >>wthr.tmp
  178.  
  179. rem -- And convert to DOC format with MAKEDOC.EXE
  180. makedoc wthr.tmp wthr.pdb  Weather
  181.  
  182.  
  183. rem -- If you have a batch install program
  184. rem -- you can install the WTHR.PDB file right now. 
  185. rem -- I use PINSTALL.EXE
  186.  
  187. rem ---------------------USER MODIFIABLE---------------------
  188. ..\pinstall wthr.pdb
  189. rem ---------------------USER MODIFIABLE---------------------
  190.  
  191.  
  192. rem -- Now clean up a bit
  193.  
  194. rem ---------------------USER MODIFIABLE---------------------
  195. rem -- del *.tmp
  196. rem -- del wthr.pdb
  197. rem ---------------------USER MODIFIABLE---------------------
  198.  
  199. rem -- That's it!
  200. :END
  201.